package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.Attractions;
import cn.wolfcode.luowowo.article.mapper.AttractionsMapper;
import cn.wolfcode.luowowo.article.query.AttractionsQuery;
import cn.wolfcode.luowowo.article.service.IAttractionsService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class AttractionsServiceImpl implements IAttractionsService {


    @Autowired
    private AttractionsMapper attractionsMapper;


    @Override
    public List<Attractions> Top5(Long destId) {

        return attractionsMapper.Top5(destId);
    }

    @Override
    public List<Attractions> hotList(Long destId) {

        return attractionsMapper.hotList(destId);
    }

    @Override
    public PageInfo pageResult(AttractionsQuery qo,Long destId) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Attractions> list = attractionsMapper.pageResult(qo.getCharacteristicId(),destId);
        PageInfo<Attractions> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public Attractions selectById(Long id) {
        return attractionsMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<Attractions> selectSonById(Long id) {
        return attractionsMapper.selectSonById(id);
    }

    @Override
    public void addReplynumByDetailId(Long attractionsId) {
        attractionsMapper.addReplynumByDetailId(attractionsId);
    }

    @Override
    public Attractions get(Long id) {

        return attractionsMapper.selectByPrimaryKey(id);
    }


    @Override
    public PageInfo<Attractions> selectForList(AttractionsQuery qo,Long uid) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize());
        List<Attractions> list = attractionsMapper.selectForList(qo ,uid);
        PageInfo<Attractions> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }

    @Override
    public List<Attractions>selectReviewSize(Long id) {

        return attractionsMapper.selectReviewSize(id);
    }


}
